package com.shrcl.engineerprocess.domain.impl;

import com.shrcl.engineerprocess.domain.MonthlyLevelCost;
import com.shrcl.engineerprocess.domain.proxy.MonthlyLevelCostProxy;
import edu.fudan.mylang.pf.BaseModelObject;
import edu.fudan.mylang.pf.IObjectFactory;
import edu.fudan.mylang.utils.DateUtil;
import edu.fudan.mylang.utils.DateUtil.Month;
import java.util.Date;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.hibernate.annotations.DiscriminatorOptions;

@Entity
@DiscriminatorValue("MONTHLYLEVELCOST_TYPE")
@DiscriminatorOptions(force = true)
@DiscriminatorColumn(length = 64)
@Table(name = "monthlylevelcost")
public class MonthlyLevelCostImpl extends BaseModelObject implements MonthlyLevelCost {
  public MonthlyLevelCostImpl() {
    super();
  }
  
  private Date month;
  
  public Date getMonth() {
    return this.month;
  }
  
  public MonthlyLevelCost setMonth(final Date month) {
    this.month = month;
    return this;			
    
  }
  
  private Double avgCost;
  
  public Double getAvgCost() {
    return this.avgCost;
  }
  
  public MonthlyLevelCost setAvgCost(final Double avgCost) {
    this.avgCost = avgCost;
    return this;			
    
  }
  
  public String getMonthStr() {
    Month _month = DateUtil.getMonth(this.month);
    String _serialize = _month.serialize();
    return _serialize;
  }
  
  public static MonthlyLevelCost create(final IObjectFactory objectFactory) {
    com.shrcl.engineerprocess.domain.MonthlyLevelCost monthlyLevelCost = new com.shrcl.engineerprocess.domain.impl.MonthlyLevelCostImpl(
    );
    objectFactory.create(monthlyLevelCost);
    return monthlyLevelCost;			
    
  }
  
  public static MonthlyLevelCost createMonthlyLevelCostImpl(final IObjectFactory objectFactory, final Procedure1<MonthlyLevelCost> init) {
    com.shrcl.engineerprocess.domain.MonthlyLevelCost monthlyLevelCost = new com.shrcl.engineerprocess.domain.impl.MonthlyLevelCostImpl(
    );
    objectFactory.create(monthlyLevelCost);
    init.apply(monthlyLevelCost);
    
    return monthlyLevelCost;			
    
  }
  
  public MonthlyLevelCostProxy toProxy() {
    com.shrcl.engineerprocess.domain.proxy.MonthlyLevelCostProxy proxy = new com.shrcl.engineerprocess.domain.proxy.MonthlyLevelCostProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
